#include "timer.h"

void ble_scan_timer_cb(void* arg)
{
    ble_scan_end=true;
}

void pairing_timer_cb(void* arg)
{
    pairing_timeout=true;
    printf("pairing_timeout\r\n");
}

void soft_timer_init(void)
{
    const esp_timer_create_args_t ble_scan_timer_args = {
    .callback = &ble_scan_timer_cb,
    .name = "ble_scan_timer"
    };
    ESP_ERROR_CHECK(esp_timer_create(&ble_scan_timer_args, &ble_scan_timer));     
    ble_scan_end=true;

    const esp_timer_create_args_t pairing_timer_args = {
    .callback = &pairing_timer_cb,
    .name = "pairing_timer"
    };
    esp_timer_handle_t pairing_timer;
    ESP_ERROR_CHECK(esp_timer_create(&pairing_timer_args, &pairing_timer));     
    esp_timer_start_once(pairing_timer, 20000000);
    pairing_timeout=false;

}
void hw_timer_init(void)
{

}

void all_timer_init()
{
    soft_timer_init();
    hw_timer_init();
}